# _*_ coding:utf-8 _*_
"""
:File: amazon_product_data.py
:Author: cfp
:Date: 2025/9/9 16:21
:LastEditTime: 2025/9/9 16:21
:LastEditors: cfp
:Description:
"""

from django.db import models


class AmazonProductData(models.Model):
    """目标表：存储爬取结果（时序表）"""

    asin = models.TextField()
    title = models.TextField(null=True)
    price = models.DecimalField(max_digits=10, decimal_places=2, null=True)
    status = models.IntegerField()
    is_delete = models.IntegerField()
    crawl_time = models.DateTimeField()  # 时序分区列（UTC时间）

    class Meta:
        db_table = "amazon_product_data"
        indexes = [
            models.Index(fields=["asin", "crawl_time"]),  # 优化查询
        ]
